# -*- coding: utf8 -*-
import requests
import random
import json
def main_handler(event,context):
    url = 'http://fangyi.tjau.edu.cn/app/bodyTemperature/update'
    a=str(random.randint(4,6))
    data = "quantumId=41&temperature=36."+a #41代表早上 42代表中午 43 代表晚上
    headers = {
        'Host':'fangyi.tjau.edu.cn',
        'Connection':'keep-alive',
        'Content-Length':'29',
        'XPS-UserToken':'B69C6B37B9B91573B9B67A2DF1A37.........70F0387B4DA00625F02DB82C141B8B94',
        'Origin':'http://fangyi.tjau.edu.cn',
        'XPS-LoginType':'WEIXIN',
        'User-Agent':"Mozilla/5.0 (Linux; Android 9; PCDM10 Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36 wxwork/3.0.20 MicroMessenger/7.0.1 NetType/WIFI Language/zh Lang/zh",
        'XPS-Token':'B69C6B37B9B91573B9B67A2DF1A37.........70F0387B4DA00625F02DB82C141B8B94',
        'XPS-UserId':'1xxxx3',
        'Content-Type':"application/x-www-form-urlencoded; charset=UTF-8",
     'Accept':"application/json, text/plain, */*",
     'XPS-ClientCode':'tjny',
        'X-Requested-With':'com.tencent.wework',
        'Referer':'http://fangyi.tjau.edu.cn/h5/temperature-report/index.html',
     'Accept-Encoding':"gzip, deflate",
        'Accept-Language':'zh-CN'
    }
    r = requests.post(url, headers=headers, data=data)
    print(r.text)
    data2 = {'msg':'你的温度提交啦！看一下是否成功'+r.text+'如果成功提交那么本次提交温度为：36.'+a}
    s = requests.post('https://qmsg.zendee.cn:443/send/e330f0.......df5c9aff',params=data2)
    print(s.text)
